<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2007 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../../infrastructure/test.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xbrlfe="http://xbrl.org/2008/formula/error"
  xmlns:binding="http://xbrl.org/2008/binding/errors"
  xmlns:label="http://xbrl.org/2008/label/errors"
  xmlns:reference="http://xbrl.org/2008/reference/errors"  
  xsi:schemaLocation="http://xbrl.org/2008/conformance ../../infrastructure/test.xsd">
  <creator>
    <name>Geoff Shuetrim</name>
    <email>geoff@galexy.net</email>
  </creator>
  <number>0004</number>
  <name>Compute end balance for a stock flow analysis using a restated
  amount as the initial stock</name>
  <description>
    The example involves derivation of a end stock from
  a start stock and an  inflow and an outflow over a following duration, where the
  initial stock has been restated.
  </description>
  <reference specification="FORMULA" id="sec-formula"/>
  <reference specification="VARIABLES" id="sec-fact-variables"/>
  <reference specification="CONCEPTFILTERS" id="sec-concept-name-filter"/>
  <reference specification="GENERICLABELS" id="sec-generic-label"/>
    <reference specification="DIMENSION-FILTER" id="sec-typed-dimension-filter"/>

  <variation id="V.01">
    <name>End stock := (startStock(restated) + inflow - outflow), restatement date is an xs:date"</name>
    <description>
      The example involves derivation of a end stock from 
      a restated start stock and a flow over a following duration.
      The restated start stock implies the need for conditioning on scenario
      information.  The restatement information has been expressed as 
      a typed XDT dimension.  As the restatement instant is reported as
      an xs:date it has to be advanced to the following midnight by an
      if statement to prevent XPTY0004 error.
    </description>
  <reference specification="FORMULA" id="sec-formula"/>
  <reference specification="VARIABLES" id="sec-fact-variables"/>
  <reference specification="CONCEPTFILTERS" id="sec-concept-name-filter"/>
  <reference specification="GENERICLABELS" id="sec-generic-label"/>
  <reference specification="DIMENSION-FILTER" id="sec-typed-dimension-filter"/>
    <data>
      <instance readMeFirst="true">input.xml</instance>
      <schema readMeFirst="false">concepts.xsd</schema>
      <schema readMeFirst="false">dimensions.xsd</schema>
      <linkbase readMeFirst="false">dimensions.xml</linkbase>
      <linkbase readMeFirst="false">formulae.xml</linkbase>
    </data>
    <result>
      <instance>output.xml</instance>
    </result>
  </variation>

  <variation id="V.02">
    <name>End stock := (startStock(restated) + inflow - outflow), restatement date is an xs:dateTime"</name>
    <description>
      The example involves derivation of a end stock from 
      a restated start stock and a flow over a following duration.
      The restated start stock implies the need for conditioning on scenario
      information.  The restatement information has been expressed as 
      a typed XDT dimension.  Restatement is reported as a dateTime.
    </description>
  <reference specification="FORMULA" id="sec-formula"/>
  <reference specification="VARIABLES" id="sec-fact-variables"/>
  <reference specification="CONCEPTFILTERS" id="sec-concept-name-filter"/>
  <reference specification="GENERICLABELS" id="sec-generic-label"/>
  <reference specification="DIMENSION-FILTER" id="sec-typed-dimension-filter"/>
    <data>
      <instance readMeFirst="true">input-dateTime.xml</instance>
      <schema readMeFirst="false">concepts.xsd</schema>
      <schema readMeFirst="false">dimensions.xsd</schema>
      <linkbase readMeFirst="false">dimensions.xml</linkbase>
      <linkbase readMeFirst="false">formulae.xml</linkbase>
    </data>
    <result>
      <instance>output-dateTime.xml</instance>
    </result>
  </variation>

</testcase>